package com.ly1.aicosplay.service;

import com.ly1.aicosplay.domain.po.Character;
import com.ly1.aicosplay.repository.CharacterRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CharacterService {
    
    @Autowired
    private CharacterRepository characterRepository;
    
    @Autowired
    private AiService aiService;

    public List<Character> getAllCharacters() {
        return characterRepository.getAllCharacters();
    }

    public Character getCharacter(String id) {
        return characterRepository.getCharacterById(id);
    }

    public List<Character> searchCharacters(String keyword) {
        return characterRepository.searchCharacters(keyword);
    }

    public Character saveCharacter(Character character) {
        return characterRepository.saveCharacter(character);
    }
    
    public String chatWithCharacter(String characterId, String message) {
        return aiService.chatWithCharacter(characterId, message);
    }
}